<!DOCTYPE html>
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  <meta name="description" content="tong.li&#39;s blog">
  <meta name="keyword" content="彤哥哥博客，95后技术爱好者,现就职于同程旅行/同程艺龙上海分公司，专注于互联网技术分享的平台。">
  
    <link rel="shortcut icon" href="/css/images/icon.png">
  
  <title>
    
      七牛云对象存储空间迁移脚本 | 彤哥哥的博客
    
  </title>
  <link href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  <link href="https://cdn.staticfile.org/nprogress/0.2.0/nprogress.min.css" rel="stylesheet">
  <link href="https://cdn.staticfile.org/highlight.js/9.12.0/styles/tomorrow-night.min.css" rel="stylesheet">
  
<link rel="stylesheet" href="/css/style.css">

  
  <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://cdn.staticfile.org/geopattern/1.2.3/js/geopattern.min.js"></script>
  <script src="https://cdn.staticfile.org/nprogress/0.2.0/nprogress.min.js"></script>
  
    
<script src="/js/qrious.js"></script>

  
  
  
  
    <!-- MathJax support START -->
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script type="text/javascript" src="https://cdn.staticfile.org/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <!-- MathJax support END -->
  


  
  
    
<script src="/js/local-search.js"></script>


<meta name="generator" content="Hexo 5.4.2"></head>
<div class="wechat-share">
  <img src="/css/images/logo.png" />
</div>
  <body>
    <header class="header fixed-header">
  <div class="header-container">
    <a class="home-link" href="/">
      <div class="logo"></div>
      <span>彤哥哥的博客</span>
    </a>
    <ul class="right-list">
      
        <li class="list-item">
          
            <a href="/" class="item-link">主页</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/series/" class="item-link">分类</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/tags/" class="item-link">标签</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/archives/" class="item-link">归档</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/project/" class="item-link">项目</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/about/" class="item-link">关于</a>
          
        </li>
      
      
        <li class="menu-item menu-item-search right-list">
    <a role="button" class="popup-trigger">
        <i class="fa fa-search fa-fw"></i>
    </a>
</li>
      
    </ul>
    <div class="menu">
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </div>
    <div class="menu-mask">
      <ul class="menu-list">
        
          <li class="menu-item">
            
              <a href="/" class="menu-link">主页</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/series/" class="menu-link">分类</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/tags/" class="menu-link">标签</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/archives/" class="menu-link">归档</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/project/" class="menu-link">项目</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/about/" class="menu-link">关于</a>
            
          </li>
        
      </ul>
    </div>
    
      <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
            <span class="search-icon">
                <i class="fa fa-search"></i>
            </span>
            <div class="search-input-container">
                <input autocomplete="off" autocapitalize="off"
                    placeholder="Please enter your keyword(s) to search." spellcheck="false"
                    type="search" class="search-input">
            </div>
            <span class="popup-btn-close">
                <i class="fa fa-times-circle"></i>
            </span>
        </div>
        <div id="search-result">
            <div id="no-result">
                <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
            </div>
        </div>
    </div>
</div>
    
  </div>
</header>

    <div id="article-banner">
  <h2>七牛云对象存储空间迁移脚本</h2>
  <p class="post-date">2019-11-02</p>
  <div class="arrow-down">
    <a href="javascript:;"></a>
  </div>
</div>
<main class="app-body flex-box">
  <!-- Article START -->
  <article class="post-article">
    <section class="markdown-content"><h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p>现在博客的图片都放在<a target="_blank" rel="noopener" href="https://www.qiniu.com/">七牛云</a>对象存储上面，个人用户有免费10GB的存储空间。</p>
<p>因为每一个的bucket空间分配一个七牛云的空间域名，如下示例：</p>
<blockquote>
<p>S3 域名</p>
<p>Endpoint(区域节点)： s3-cn-east-1.qiniucs.com</p>
<p>空间域名： 20191119.s3-cn-east-1.qiniucs.com</p>
<p>融合 CDN 测试域名</p>
<p> 七牛融合 CDN 测试域名（以 clouddn.com/qiniucdn.com/qiniudn.com/qnssl.com/qbox.me 结尾），每个域名每日限总流量 10GB，每个测试域名自创建起 30 个自然日后系统会自动回收，仅供测试使用并且不支持 Https 访问，详情查看 <a target="_blank" rel="noopener" href="https://developer.qiniu.com/fusion/kb/1319/test-domain-access-restriction-rules">七牛测试域名使用规范</a> 。点击域名可查看剩余回收时间。</p>
<p><a target="_blank" rel="noopener" href="https://portal.qiniu.com/cdn/domain/q176n8af9.bkt.clouddn.com">q176n8af9.bkt.clouddn.com</a></p>
</blockquote>
<p>七牛云很坑的一点就是这个测试域名有效期是30天(随口一说，人家免费给你的10G存储已经很不错了)，所以30天以后域名会自动过期，意味着里面存储的图片以及对象都不能访问。</p>
<p>解决这种问题有两种方法：</p>
<ol>
<li><p>绑定一个备案的域名(非常建议)；</p>
<p>优点：快速好管理，只有域名不过期，终身享受；</p>
<p>缺点：条件限制比较大，域名要备案。</p>
</li>
<li><p>切换bucket空间，即新建一个新的bucket，然后将旧的bucket迁移过去。</p>
<p>优点：免费</p>
<p>缺点：麻烦，每隔30天迁移一次</p>
</li>
</ol>
<h3 id="迁移"><a href="#迁移" class="headerlink" title="迁移"></a>迁移</h3><p>我只有国内的域名：<a target="_blank" rel="noopener" href="http://yeamin.top/">http://yeamin.top</a> 。</p>
<p>我的Blog域名是<a target="_blank" rel="noopener" href="http://blog.yeamin.top/">http://blog.yeamin.top</a> 。</p>
<p>因为我个人没有服务器，主域名都没有在国内备案，在我这里选择了第二种方式：迁移空间换取新的bucket和域名。</p>
<h3 id="准备工作"><a href="#准备工作" class="headerlink" title="准备工作"></a>准备工作</h3><p>打开七牛云官网，登录进入到管理控制台，左侧选择对象存储</p>
<ol>
<li>找到要迁移的bucket,即源存储；</li>
<li>新建一个bucket，即便目标存储空间；</li>
<li>下载并解压七牛云官方提供的同步迁移工具：<a target="_blank" rel="noopener" href="http://developer.qiniu.com/docs/v6/tools/qshell.html%EF%BC%9B">http://developer.qiniu.com/docs/v6/tools/qshell.html；</a></li>
<li>在右上角找到我的图像悬浮出来菜单后，选择秘钥管理，准备好AK和SK(AccessKey/SecretKey)。</li>
</ol>
<p>具体迁移可以参照七牛云的迁移文档可完成迁移工作，但是我觉得每次都这样一个一个这样迁移很麻烦，所以我今天抽空写了一段脚本去处理迁移工作。</p>
<h3 id="脚本"><a href="#脚本" class="headerlink" title="脚本"></a>脚本</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#!/bin/bash</span></span><br><span class="line"><span class="comment">#</span></span><br><span class="line"><span class="comment"># author: tong.li</span></span><br><span class="line"><span class="comment"># description: qshell bucket transfer</span></span><br><span class="line"><span class="comment"># date: 2019-11-02 14:45:22</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#准备配置环境</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;Prepare Environment...&quot;</span></span><br><span class="line"><span class="keyword">if</span> [ ! -x <span class="string">&#x27;./qshell-windows-x64-v2.4.0&#x27;</span> ]</span><br><span class="line"> <span class="keyword">then</span></span><br><span class="line"> 	<span class="built_in">echo</span> <span class="string">&quot;qshell script file not exist&quot;</span></span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [[ !<span class="string">&quot;<span class="variable">$1</span>&quot;</span> ]]; <span class="keyword">then</span></span><br><span class="line">	<span class="built_in">echo</span> -n <span class="string">&quot;please input account:&quot;</span></span><br><span class="line">	<span class="built_in">read</span> account</span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> -n <span class="string">&#x27;please input your AK:&#x27;</span></span><br><span class="line"><span class="built_in">read</span> AK</span><br><span class="line"><span class="built_in">echo</span> -n <span class="string">&#x27;please input your SK:&#x27;</span></span><br><span class="line"><span class="built_in">read</span> SK</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [[ ! <span class="string">&quot;<span class="variable">$AK</span>&quot;</span> || ! <span class="string">&quot;<span class="variable">$SK</span>&quot;</span> ]]; <span class="keyword">then</span></span><br><span class="line">	<span class="built_in">echo</span> <span class="string">&quot;AK OR SK is null, please try again&quot;</span></span><br><span class="line">	<span class="built_in">exit</span> 0</span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 已有账户列表</span></span><br><span class="line">rs=`./qshell-windows-x64-v2.4.0 user <span class="built_in">ls</span> |  awk <span class="string">&#x27;&#123;print $2&#125;&#x27;</span>`</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [[ <span class="variable">$rs</span>=~<span class="variable">$AK</span> &amp;&amp; <span class="variable">$rs</span>=~<span class="variable">$SK</span> &amp;&amp; <span class="variable">$rs</span>=~<span class="variable">$account</span> ]]; <span class="keyword">then</span></span><br><span class="line">   <span class="built_in">echo</span> <span class="string">&quot;Config OK...&quot;</span></span><br><span class="line"><span class="keyword">else</span></span><br><span class="line">	<span class="built_in">echo</span> <span class="string">&quot;Starting AK、SK Config...&quot;</span></span><br><span class="line">	./qshell-windows-x64-v2.4.0 account ak sk name</span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;account: <span class="variable">$account</span>&quot;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;AK is : <span class="variable">$AK</span>&quot;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;SK is: <span class="variable">$SK</span>&quot;</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [[ !<span class="string">&quot;<span class="variable">$sourcebucket</span>&quot;</span> ]]; <span class="keyword">then</span></span><br><span class="line">	<span class="built_in">echo</span> -n <span class="string">&quot;please input sourcebucket:&quot;</span></span><br><span class="line">	<span class="built_in">read</span> sourcebucket</span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"><span class="keyword">if</span> [[ !<span class="string">&quot;<span class="variable">$desbucket</span>&quot;</span> ]]; <span class="keyword">then</span></span><br><span class="line">	<span class="built_in">echo</span> -n <span class="string">&quot;please input desbucket:&quot;</span></span><br><span class="line">	<span class="built_in">read</span> desbucket</span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 列举当前需要复制bucket数据</span></span><br><span class="line">./qshell-windows-x64-v2.4.0 listbucket <span class="variable">$sourcebucket</span> -o cp.txt</span><br><span class="line"><span class="comment"># 生成文件列表</span></span><br><span class="line"><span class="built_in">cat</span> cp.txt | awk <span class="string">&#x27;&#123;print $1&#125;&#x27;</span> &gt; cpp.txt</span><br><span class="line"></span><br><span class="line">size=$(<span class="built_in">du</span> -sb cpp.txt|<span class="built_in">cut</span> -f1)</span><br><span class="line"><span class="keyword">if</span> [[ size &lt;=0 ]]; <span class="keyword">then</span></span><br><span class="line">	<span class="built_in">echo</span>  <span class="string">&quot;cpp.txt size is 0KB&quot;</span></span><br><span class="line">	<span class="built_in">exit</span> 0</span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 开始批量迁移</span></span><br><span class="line">./qshell-windows-x64-v2.4.0 batchcopy <span class="variable">$sourcebucket</span> <span class="variable">$desbucket</span> -i cpp.txt</span><br><span class="line"><span class="keyword">if</span> [ $? -eq 0 ]; <span class="keyword">then</span></span><br><span class="line">	<span class="built_in">echo</span> <span class="string">&quot;==============transfer bucket From <span class="variable">$sourcebucket</span> to <span class="variable">$desbucket</span> success==============================&quot;</span></span><br><span class="line"><span class="keyword">else</span></span><br><span class="line">    <span class="built_in">echo</span> <span class="string">&quot;=============================transfer bucket failed,please try again==================================&quot;</span></span><br><span class="line"><span class="keyword">fi</span></span><br></pre></td></tr></table></figure>



<h3 id="执行迁移"><a href="#执行迁移" class="headerlink" title="执行迁移"></a>执行迁移</h3><ol>
<li>将上述代码保存batchcopy.sh，并赋予可执行权限；</li>
<li>执行./batchcopy.sh  你的七牛云账户名</li>
<li>之后按输入提示输入AK、SK、源bucket、目标bucket即可完成迁移操作。</li>
</ol>
<h3 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h3><p>​       经常看别人的shell脚本，自己从来也没写过，这是是第一次写脚本，多少可能有些bug。后续发现了会及时更正他。总之还是多学多实践一下没坏处。</p>
<h2 id="参考文档"><a href="#参考文档" class="headerlink" title="参考文档"></a>参考文档</h2><ul>
<li><a target="_blank" rel="noopener" href="https://developer.qiniu.com/kodo/tools/1302/qshell">七牛云对象存储迁移文档</a></li>
<li><a target="_blank" rel="noopener" href="https://blog.csdn.net/netdxy/article/details/50506741">七牛云对象存储空间迁移详解</a></li>
</ul>
</section>
    <!-- Tags START -->
    
      <div class="tags">
        <span>Tags:</span>
        
  <a href="/tags#实用工具及技巧" >
    <span class="tag-code">实用工具及技巧</span>
  </a>

      </div>
    
    <!-- Tags END -->
    <!-- NAV START -->
    
  <div class="nav-container">
    <!-- reverse left and right to put prev and next in a more logic postition -->
    
      <a class="nav-left" href="/2019/10/12/%E8%B7%A8%E5%B9%B3%E5%8F%B0%E5%8A%9E%E5%85%AC%E5%88%A9%E5%99%A8-uTools/">
        <span class="nav-arrow">← </span>
        
          跨平台办公利器-uTools
        
      </a>
    
    
      <a class="nav-right" href="/2019/11/08/RocketMQ%E6%A6%82%E8%BF%B0/">
        
          RocketMQ概述
        
        <span class="nav-arrow"> →</span>
      </a>
    
  </div>

    <!-- NAV END -->
    <!-- 打赏 START -->
    
      <div class="money-like">
        <div class="reward-btn">
          赏
          <span class="money-code">
            <span class="alipay-code">
              <div class="code-image"></div>
              <b>使用支付宝打赏</b>
            </span>
            <span class="wechat-code">
              <div class="code-image"></div>
              <b>使用微信打赏</b>
            </span>
          </span>
        </div>
        <p class="notice">若你觉得我的文章对你有帮助，欢迎点击上方按钮对我打赏</p>
      </div>
    
    <!-- 打赏 END -->
    <!-- 二维码 START -->
    
      <div class="qrcode">
        <canvas id="share-qrcode"></canvas>
        <p class="notice">扫描二维码，分享此文章</p>
      </div>
    
    <!-- 二维码 END -->
    
      <!-- Utterances START -->
      <div id="utterances"></div>
      <script src="https://utteranc.es/client.js"
        repo="ltyeamin/blogtalks"
        issue-term="pathname"
        theme="github-light"
        crossorigin="anonymous"
        async></script>    
      <!-- Utterances END -->
    
  </article>
  <!-- Article END -->
  <!-- Catalog START -->
  
    <aside class="catalog-container">
  <div class="toc-main">
    <strong class="toc-title">Catalog</strong>
    
      <ol class="toc-nav"><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#%E5%89%8D%E8%A8%80"><span class="toc-nav-text">前言</span></a><ol class="toc-nav-child"><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#%E8%BF%81%E7%A7%BB"><span class="toc-nav-text">迁移</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C"><span class="toc-nav-text">准备工作</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#%E8%84%9A%E6%9C%AC"><span class="toc-nav-text">脚本</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#%E6%89%A7%E8%A1%8C%E8%BF%81%E7%A7%BB"><span class="toc-nav-text">执行迁移</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#%E6%80%BB%E7%BB%93"><span class="toc-nav-text">总结</span></a></li></ol></li><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#%E5%8F%82%E8%80%83%E6%96%87%E6%A1%A3"><span class="toc-nav-text">参考文档</span></a></li></ol>
    
  </div>
</aside>
  
  <!-- Catalog END -->
</main>

<script>
  (function () {
    var url = 'http://example.com/2019/11/02/七牛云对象存储空间迁移脚本/';
    var banner = ''
    if (banner !== '' && banner !== 'undefined' && banner !== 'null') {
      $('#article-banner').css({
        'background-image': 'url(' + banner + ')'
      })
    } else {
      $('#article-banner').geopattern(url)
    }
    $('.header').removeClass('fixed-header')

    // error image
    $(".markdown-content img").on('error', function() {
      $(this).attr('src', '/css/images/error_icon.png')
      $(this).css({
        'cursor': 'default'
      })
    })

    // zoom image
    $(".markdown-content img").on('click', function() {
      var src = $(this).attr('src')
      if (src !== '/css/images/error_icon.png') {
        var imageW = $(this).width()
        var imageH = $(this).height()

        var zoom = ($(window).width() * 0.95 / imageW).toFixed(2)
        zoom = zoom < 1 ? 1 : zoom
        zoom = zoom > 2 ? 2 : zoom
        var transY = (($(window).height() - imageH) / 2).toFixed(2)

        $('body').append('<div class="image-view-wrap"><div class="image-view-inner"><img src="'+ src +'" /></div></div>')
        $('.image-view-wrap').addClass('wrap-active')
        $('.image-view-wrap img').css({
          'width': `${imageW}`,
          'transform': `translate3d(0, ${transY}px, 0) scale3d(${zoom}, ${zoom}, 1)`
        })
        $('html').css('overflow', 'hidden')

        $('.image-view-wrap').on('click', function() {
          $(this).remove()
          $('html').attr('style', '')
        })
      }
    })
  })();
</script>


  <script>
    var qr = new QRious({
      element: document.getElementById('share-qrcode'),
      value: document.location.href
    });
  </script>






    <div class="scroll-top">
  <span class="arrow-icon"></span>
</div>
    <footer class="app-footer">
  <p class="copyright">
    &copy; 2024 | Proudly powered by <a href="https://hexo.io" target="_blank">Hexo</a>
    <br>
    Theme by <a target="_blank" rel="noopener" href="https://github.com/ltyeamin">tong.li</a>
  </p>
</footer>

<script>
  function async(u, c) {
    var d = document, t = 'script',
      o = d.createElement(t),
      s = d.getElementsByTagName(t)[0];
    o.src = u;
    if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
    s.parentNode.insertBefore(o, s);
  }
</script>
<script>
  async("https://cdn.staticfile.org/fastclick/1.0.6/fastclick.min.js", function(){
    FastClick.attach(document.body);
  })
</script>

<script>
  var hasLine = 'true';
  async("https://cdn.staticfile.org/highlight.js/9.12.0/highlight.min.js", function(){
    $('figure pre').each(function(i, block) {
      var figure = $(this).parents('figure');
      if (hasLine === 'false') {
        figure.find('.gutter').hide();
      }
      hljs.configure({useBR: true});
      var lang = figure.attr('class').split(' ')[1] || 'code';
      var codeHtml = $(this).html();
      var codeTag = document.createElement('code');
      codeTag.className = lang;
      codeTag.innerHTML = codeHtml;
      $(this).attr('class', '').empty().html(codeTag);
      figure.attr('data-lang', lang.toUpperCase());
      hljs.highlightBlock(block);
    });
  })
</script>
<!-- Baidu Tongji -->



<script src='https://cdn.staticfile.org/mermaid/8.11.2/mermaid.min.js'></script>



<script src="/js/script.js"></script>


  </body>
</html>